<?php

namespace app\model;

use app\common\facade\auth\Auth;
use app\ymsh\model\CouponOrder;
use think\Model;

class Order
{
    public function getWith()
    {
        $with =  [
            'agent' => function (\think\db\Query $query) {
                $query->with(['agentExtend' => function (\think\db\Query $query) {
                    $query->field('agent_id,app_name,merchant_name,merchant_id,app_id');
                }])->field('company_name,id');
            },
//            'user' => function (\think\db\Query $query) {
//                $query->field('openid', 'agent_id');
//            }
        ];

        $path = request()->pathinfo();



        if (Auth::from()  == FROM_APP_YMSH && $path != 'order/movie'){
            array_push($with,'movieOrder');
        }

        return $with;
    }


}